<template>
  <a-card :loading="loading" :bordered="false">
    <div class="card-container">
      <div class="left-container">
        <img src="@/assets/images/credit/statistics/num.png" alt="">
        <div class="text">
          <div class="title">{{ title }}</div>
          <div class="value">{{ total }}</div>
        </div>
      </div>
      <div class="right-container">
        <a-tooltip :title="tooltip" class="chart-card-action">
          <a-icon type="info-circle-o" />
        </a-tooltip>
      </div>
    </div>
  </a-card>
</template>

<script>
export default {
  name: 'ChartCard',
  props: {
    title: {
      type: String,
      default: () => '',
    },
    tooltip: {
      type: String,
      default: () => '收款金额',
    },
    total: {
      type: [Function, Number, String],
      required: false,
      default: null,
    },
    loading: {
      type: Boolean,
      default: false,
    },
  },
}
</script>

<style lang="scss" scoped>
.card-container {
  display: flex;
  justify-content: space-between;
  .left-container {
    display: flex;
    img {
      width: 70px;
      height: 70px;
    }
    .text {
      margin-left: $margin-xs;
      .title {
        color: rgba($color: $black, $alpha: 0.4);
        font-size: $font-size-sm;
      }

      .value {
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
        white-space: nowrap;
        color: $black;
        margin-top: 4px;
        margin-bottom: 0;
        font-size: 30px;
        line-height: 38px;
        height: 38px;
      }
    }
  }

  .right-container {
    .chart-card-action {
      cursor: pointer;
      color: rgba($color: $black, $alpha: 0.4);
    }
  }
}
</style>
